import request from '@/utils/request'

// 查询代用料信息维护列表
export function listDylList(query) {
  return request({
    url: '/project/dylList/list',
    method: 'get',
    params: query,
  })
}

// 查询代用料信息维护详细
export function getDylList(dylId) {
  return request({
    url: '/project/dylList/' + dylId,
    method: 'get',
  })
}

// 查询代用料信息维护详细
export function getDylListById(dylId) {
  return request({
    url: '/project/dylList/getDylById/' + dylId,
    method: 'get',
  })
}

// 新增代用料信息维护
export function addDylList(data) {
  return request({
    url: '/project/dylList',
    method: 'post',
    data: data,
  })
}
// 新增代用料信息维护
export function addBatch(data) {
  return request({
    url: '/project/dylList/addBatch',
    method: 'post',
    data: data,
  })
}

export function fuzzyMatching(wldm) {
  return request({
    url: '/project/dylList/itmByWldm/' + wldm,
    method: 'get',
  })
}

// 修改代用料信息维护
export function updateDylList(data) {
  return request({
    url: '/project/dylList',
    method: 'put',
    data: data,
  })
}
//查询代用料父项子项的数量
export function getDylByFxZx(query) {
  return request({
    url: '/project/dylList/getDylByFxZx',
    method: 'get',
    params: query,
  })
}

// 删除代用料信息维护
export function delDylList(dylId) {
  return request({
    url: '/project/dylList/' + dylId,
    method: 'delete',
  })
}

// 导出代用料信息维护
export function exportDylList(query) {
  return request({
    url: '/project/dylList/export',
    method: 'get',
    params: query,
  })
}

//修改状态
export function changeDylFlag(dylId, dylFlag) {
  const data = {
    dylId,
    dylFlag,
  }
  return request({
    url: '/project/dylList/changeFlag',
    method: 'put',
    data: data,
  })
}

// 父子项校验
export function judgeBomAc(query) {
  return request({
    url: '/project/bom/judgeBomAc',
    method: 'get',
    params: query,
  })
}
